/* QtLua -- Lua bindings for Qt
   Copyright (C) 2011, Jarek Pelczar

   This library is free software; you can redistribute it and/or
   modify it under the terms of the GNU Lesser General Public
   License as published by the Free Software Foundation; either
   version 3 of the License, or (at your option) any later version.

   This library is distributed in the hope that it will be useful,
   but WITHOUT ANY WARRANTY; without even the implied warranty of
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
   Lesser General Public License for more details.

   You should have received a copy of the GNU Lesser General
   Public License along with this library; if not, write to the
   Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
   Boston, MA 02110-1301 USA

*/

#ifndef QLUASCRIPTPROGRAM_H
#define QLUASCRIPTPROGRAM_H

#include <QString>
#include <QSharedDataPointer>

class QLuaScriptProgramData;

class QLuaScriptProgram
{
public:
    enum ScriptType {
        TextScript,
        ByteCode
    };

    QLuaScriptProgram();
    explicit QLuaScriptProgram(const QString& sourceCode, const QString& fileName = QString());
    explicit QLuaScriptProgram(const QByteArray& program, const QString& fileName = QString());
    QLuaScriptProgram(const QLuaScriptProgram& other);
    ~QLuaScriptProgram();
    QLuaScriptProgram& operator = (const QLuaScriptProgram& other);

    bool isNull() const;

    ScriptType type() const;
    QString fileName() const;
    QString text() const;
    QByteArray byteCode() const;

    bool operator == (const QLuaScriptProgram& other);

private:
    QSharedDataPointer<QLuaScriptProgramData> d;
};

#endif // QLUASCRIPTPROGRAM_H
